"""
员工添加
员工共修改
员工共查询
员工共删除

"""
import app
import requests
# employee 员工
class EmployeeAPI:
    # 初始化
    def __init__(self):
        self.url_add_employee = app.BASE_URL+"/api/sys/user"
        self.url_modify_employee = app.BASE_URL + "/api/sys/user/{}"
        self.url_get_employee = app.BASE_URL + "/api/sys/user/{}"
        self.url_delete_employee = app.BASE_URL + "/api/sys/user/{}"

    # 员工添加(添加的对应的接口，添加的数据，)
    def add_employee(self,add_employee_data):
        print(app.headers_data)
        return requests.post(url=self.url_add_employee, json=add_employee_data,headers=app.headers_data)

    # 员工共修改
    def modify_employee(self,employee_id, update_data):
        url = self.url_modify_employee.format(employee_id)
        return requests.put(url=url, json=update_data, headers=app.headers_data)

    # 员工共查询
    def get_employee(self,employee_id):
        return requests.get(url=self.url_get_employee.format(employee_id), headers=app.headers_data)

    # 员工共删除
    def delete_employee(self,employee_id):
        return requests.delete(url=self.url_get_employee.format(employee_id), headers=app.headers_data)